package com.me.brainlessbirds.actors.obstacles.units;

import java.util.ArrayList;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.me.brainlessbirds.Assets;
import com.me.brainlessbirds.actors.GameObject;
import com.me.brainlessbirds.actors.obstacles.Obstacle;
import com.me.brainlessbirds.actors.skills.BaseAttack;
import com.me.brainlessbirds.actors.skills.Charge;
import com.me.brainlessbirds.actors.zombies.units.Brainless;
import com.me.brainlessbirds.actors.zombies.units.Undertaker;
import com.me.brainlessbirds.actors.zombies.units.Winehouse;

public class Barricade extends Obstacle
{
	public Barricade()
	{
		type = ObstacleType.BARRICADE;
		life = 5f;
		rgn = new TextureRegion(Assets.get().textureBarricade);
		rgnDown = new TextureRegion(Assets.get().textureBarricadeDown);
		destructionDelay = 0.1f;

		setSize(64.0f, 64.0f);
		setOrigin(getWidth() / 2, getHeight() / 2);
	}

	@Override
	public void repare()
	{
		super.repare();
		this.life = 3f;
	}

	@Override
	public void OnHitByBrainless(Brainless _b)
	{
		ArrayList<GameObject> targetsArrayList = new ArrayList<GameObject>();
		targetsArrayList.add(this);
		_b.skillMap.get(BaseAttack.class).launchEffect(targetsArrayList);
	}

	@Override
	public void OnHitByWinehouse(Winehouse _w)
	{
		ArrayList<GameObject> targetsArrayList = new ArrayList<GameObject>();
		targetsArrayList.add(this);
		_w.skillMap.get(BaseAttack.class).launchEffect(targetsArrayList);
	}

	@Override
	public void OnHitByUndertaker(Undertaker _u)
	{
		ArrayList<GameObject> targetsArrayList = new ArrayList<GameObject>();
		targetsArrayList.add(this);
		if (_u.skillMap.get(Charge.class).launchEffect(targetsArrayList) == false)
		{
			_u.skillMap.get(BaseAttack.class).launchEffect(targetsArrayList);
		}
	}
}
